﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Viewer.Login" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>VPDT-Đăng nhập</title>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="X"  Locale="vi" >
        <Listeners>
            <DocumentReady Handler="Ext.net.DirectEvent.timeout = 360000;" />
            <AjaxRequestException Handler="Ext.net.Mask.hide();" />
            <BeforeAjaxRequest Handler="Ext.net.Mask.show();" />
            <AjaxRequestComplete Handler ="Ext.net.Mask.hide();" />
        </Listeners>
    </ext:ResourceManager>  
    <div>
      <ext:Window 
        ID="LoginWindow"
        runat="server" 
        Closable="false"
        Resizable="false"
        Height="130" 
        Icon="Lock"
        Title="Đăng nhập"
        Draggable="true"
        Width="300"
        Modal="true"
        BodyBorder="false"        
        BodyStyle="padding:5px;">
        <Items>
                <ext:FormPanel ID="FormPanel1" 
                    runat="server" 
                    Border="false"
                    BodyBorder="false" 
                    BodyStyle="background:transparent;" 
                    >
                    <Items>
                        <ext:TextField 
                            ID="txtUsername" 
                            runat="server" 
                            FieldLabel="Tên đăng nhập" 
                            AnchorHorizontal="100%"
                            Text="admin"
                         />
                        
                         <ext:TextField 
                            ID="txtPassword" 
                            runat="server" 
                            InputType="Password" 
                            FieldLabel="Mật khẩu" 
                            AnchorHorizontal="100%"
                            Text="admin"
                          />
                    </Items>
                </ext:FormPanel>
        </Items>
        <Buttons>
            <ext:Button ID="btnLogin" runat="server" Text="Đăng nhập" Icon="Accept" >
                <Listeners>
                    <Click Handler="
                        if(#{txtUsername}.getValue()=='')
                        {
                            Ext.MessageBox.show({title:'Thông Báo',
                            msg:'Bạn chưa nhập Tên đăng nhập !',
                            buttons: Ext.MessageBox.OK,
                            fn:function(btn){#{txtUsername}.focus(false,20)}
                            });
                            return false;
                        }
                        if(#{txtPassword}.getValue()=='')
                        {
                            Ext.MessageBox.show({title:'Thông Báo',
                            msg:'Bạn chưa nhập Mật khẩu !',
                            buttons: Ext.MessageBox.OK,
                            fn:function(btn){#{txtPassword}.focus(false,20)}
                            });
                            return false;
                        }
                    " />
                </Listeners>
                <DirectEvents>
                    <Click OnEvent="btnLogin_Click">
                    </Click>                   
                </DirectEvents>
            </ext:Button>
        </Buttons>
        <Listeners>
            <BeforeShow Handler="#{txtUsername}.focus(false,20);" />
        </Listeners>
        <KeyMap>
            <ext:KeyBinding >
                <Keys>
                    <ext:Key Code="ENTER" />
                </Keys>
                <Listeners>
                    <Event Handler="#{btnLogin}.fireEvent('click');" />
                </Listeners>
            </ext:KeyBinding>
        </KeyMap>
    </ext:Window>
        
    </div>
    </form>
</body>
</html>